package org.stvd.entities.common;

import java.io.Serializable;

/**
 * @Title WebReflectPK
 * @Destribution 前台请求与响应service映射关系 联合主键
 * @author houzx
 * @date 2020年4月1日
 */
public class WebReflectPK implements Serializable{

    private static final long serialVersionUID = 7671082331370001960L;
    
    /**
     * 请求路径
     */
    private String requestUrl = "";
    /**
     * 请求方式：GET 或 POST
     */
    private String requestMethod = "";
    
    /**
     * {@link WebReflect} 的联合主键
     * @param requestUrl 请求路径
     * @param requestMethod 请求方式：GET 或 POST
     */
    public WebReflectPK(String requestUrl, String requestMethod) {
    this.requestUrl = requestUrl;
    this.requestMethod = requestMethod;
    }
    public WebReflectPK() {}
    
    public String getRequestUrl() {
        return requestUrl;
    }
    public void setRequestUrl(String requestUrl) {
        this.requestUrl = requestUrl;
    }
    public String getRequestMethod() {
    	return requestMethod;
    }
    public void setRequestMethod(String requestMethod) {
        this.requestMethod = requestMethod;
    }
    
    /**
     * 覆盖hashCode方法，必须要有
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result
                + ((requestMethod == null) ? 0 : requestMethod.hashCode());
        result = prime * result
                + ((requestUrl == null) ? 0 : requestUrl.hashCode());
        return result;
    }
    
    /**
     * 覆盖equals方法，必须要有
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        WebReflectPK other = (WebReflectPK) obj;
        if (requestMethod == null) {
            if (other.requestMethod != null)
                return false;
        } else if (!requestMethod.equals(other.requestMethod))
            return false;
        if (requestUrl == null) {
            if (other.requestUrl != null)
                return false;
        } else if (!requestUrl.equals(other.requestUrl))
            return false;
        return true;
    }
}
